#圆周率计算.py
#近似计算公式法
pi = 0.0
for k in range(3000):
    pi += 1/pow(16, k) * \
          (4/(8*k+1) - \
           2/(8*k+4) - \
           1/(8*k+5) - \
           1/(8*k+6))
print(pi)
